<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>毕业论文管理系统</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
<link rel="shortcut icon"
	href="${pageContext.request.contextPath }/favicon.ico"
	type="${pageContext.request.contextPath }/image/x-icon" />
<link rel="stylesheet"
	href="${pageContext.request.contextPath }/css/font.css">
<link rel="stylesheet"
	href="${pageContext.request.contextPath }/css/xadmin.css">
<script type="text/javascript"
	src="${pageContext.request.contextPath }/js/jquery-3.3.1.min.js"></script>
<script src="${pageContext.request.contextPath }/lib/layui/layui.js"
	charset="utf-8"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath }/js/xadmin.js"></script>
<!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
<!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
		<div class="x-body">
        <form class="layui-form">
      		<textarea name="suggest" rows="8" class="layui-textarea"></textarea>
      		<input type="hidden" name="id" value="${id }"/>
      		<br />
      		<button  class="layui-btn" style="float: right;" lay-filter="add" lay-submit="">提交</button>
        </form>
       </div>
	</body>
	<script>
        layui.use(['form','layer'], function(){
            $ = layui.jquery;
          var form = layui.form
          ,layer = layui.layer;
        
          //监听提交
          form.on('submit(add)', function(data){
            console.log(data);
            $.ajax({
        		url : "${pageContext.request.contextPath }/teacher/addSuggest.do",
        		type : "post", 
        		data : JSON.stringify(data.field),
        		contentType : "application/json;charset=UTF-8",
        		dataType : "json",
        		//成功响应的结果
        		success : function(data){
        			if(data != null){					
			            layer.alert(data.msg, {icon: 6},function () {
			                // 获得frame索引
			                var index = parent.layer.getFrameIndex(window.name);
			                //关闭当前frame
			                parent.layer.close(index);
			            });
        			}
        		}
          	}); 
            return false;
          });
          
          
        });
    </script>
</html>